from flask import Flask
from models import db
from user_blueprint import user_bp
from instance.config import Config
from flask_cors import CORS

app = Flask(__name__)
app.config.from_object(Config)
CORS(app,resources={r'/api/*':{"origins":["http://localhost:8080","http://127.0.0.1:8080"]}})

db.init_app(app)

# 创建数据库表
with app.app_context():
    db.create_all()

# 注册用户蓝图
app.register_blueprint(user_bp, url_prefix='/api')

if __name__ == '__main__':
    app.run(debug=True)